package junior.util.function;

import junior.util.exception.ExceptionUtils;

import java.util.function.BiConsumer;


/**
 * 将Exception转换为CheckedException的BiConsumer
 * @author WuBo
 * @date 2019年11月20日
 * @param <T>
 * @param <U>
 */
@FunctionalInterface
public interface CheckedBiConsumer<T, U> extends BiConsumer<T, U> {

	@Override
    default void accept(final T t, final U u) {
        try {
            acceptThrows(t, u);
        } catch (final Exception e) {
            throw ExceptionUtils.wrap2Runtime(e);
        }
    }

    void acceptThrows(T t, U u) throws Exception;
}